<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
        <html lang="zh">

        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>全部图书信息</title>
            <link rel="shortcut icon" href="img/library.ico" />
            <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
            <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
            <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>

            <style>
                body {
                    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
                    background-image: url('img/华师2.jpg.v');
                    background-size: cover;
                    background-position: center center;
                    color: var(--dark-text);
                    min-height: 100vh;
                    padding-top: 60px;
                }

                .navbar {
                    background-color: #fff !important;
                    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
                    padding: 10px 0;
                    position: fixed;
                    top: 0;
                    width: 100%;
                    z-index: 1000;
                }

                .navbar-brand p {
                    font-family: "华文行楷", "楷体", cursive;
                    font-size: 28px;
                    font-weight: bold;
                    color: #337ab7 !important;
                    margin: 0;
                }

                .navbar-nav .nav-link {
                    color: #333 !important;
                    font-weight: 500;
                    padding: 10px 15px;
                    transition: all 0.3s ease;
                }

                .navbar-nav .nav-link:hover {
                    color: #fff !important;
                    background-color: #337ab7 !important;
                }

                .main-container {
                    max-width: 1200px;
                    margin: 60px auto;
                    padding: 20px;
                }

                .page-title {
                    text-align: center;
                    margin-bottom: 40px;
                    color: #333;
                }

                .page-title h1 {
                    font-size: 2.8rem;
                    margin-bottom: 10px;
                    position: relative;
                    display: inline-block;
                }

                .page-title h1::after {
                    content: '';
                    position: absolute;
                    bottom: -10px;
                    left: 50%;
                    transform: translateX(-50%);
                    width: 100px;
                    height: 4px;
                    background: #3498db;
                    border-radius: 2px;
                }

                .panel {
                    background: #fff;
                    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
                    margin-top: 20px;
                    border-radius: 10px;
                }

                .panel-heading {
                    background-color: #f8f9fa;
                    padding: 15px;
                    border-radius: 10px 10px 0 0;
                }

                .panel-body {
                    padding: 20px;
                }

                table {
                    width: 100%;
                    margin-bottom: 20px;
                    border-collapse: collapse;
                }

                th,
                td {
                    padding: 10px;
                    text-align: left;
                    border: 1px solid #ddd;
                }

                th {
                    background-color: #f8f9fa;
                }

                tr:hover {
                    background-color: #f1f1f1;
                }

                .btn {
                    border-radius: 5px;
                    font-weight: bold;
                }

                .btn-primary {
                    background-color: #3498db;
                    border-color: #3498db;
                }

                .btn-primary:hover {
                    background-color: #2980b9;
                    border-color: #2980b9;
                }

                .btn-danger {
                    background-color: #e74c3c;
                    border-color: #e74c3c;
                }

                .btn-danger:hover {
                    background-color: #c0392b;
                    border-color: #c0392b;
                }

                .btn-success {
                    background-color: #2ecc71;
                    border-color: #2ecc71;
                }

                .btn-success:hover {
                    background-color: #27ae60;
                    border-color: #27ae60;
                }

                .alert {
                    border-radius: 5px;
                }
            </style>
        </head>

        <body>
            <!-- 自定义导航栏 -->
            <nav class="navbar navbar-expand-lg navbar-light">
                <div class="container-fluid">
                    <a class="navbar-brand" href="/admin_main.html">
                        <p class="text-primary" style="font-family: 华文行楷; font-size: 28px;">智慧图书馆</p>
                    </a>
                    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarNav">
                        <ul class="navbar-nav me-auto">
                            <li class="nav-item">
                                <a class="nav-link" href="/admin_books.html">图书管理</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="/allreaders.html">读者管理</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="/lendlist.html">借还管理</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="/admin_repasswd.html">密码修改</a>
                            </li>
                        </ul>
                        <ul class="navbar-nav">
                            <li class="nav-item">
                                <a class="nav-link" href="/admin_info.html">${admin.username}, 已登录</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="/login.html">退出</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>

            <!-- 搜索表单 -->
            <div style="padding: 20px 550px 10px">
                <form method="post" action="querybook.html" class="form-inline" id="searchform">
                    <div class="input-group">
                        <input type="text" placeholder="输入图书名" class="form-control" id="search" name="searchWord">
                        <span class="input-group-btn">
                            <input type="submit" value="搜索" class="btn btn-primary">
                        </span>
                    </div>
                </form>
                <script>
                    $("#searchform").submit(function () {
                        var val = $("#search").val();
                        if (val == '') {
                            alert("请输入关键字");
                            return false;
                        }
                    })
                </script>
            </div>

            <!-- 显示信息 -->
            <div style="position: relative;top: 10%">
                <c:if test="${!empty succ}">
                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                        ${succ}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                </c:if>
                <c:if test="${!empty error}">
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        ${error}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                </c:if>
            </div>

            <!-- 图书展示 -->
            <div class="panel panel-default" style="width: 90%; margin-left: 5%">
                <div class="panel-heading" style="background-color: #fff">
                    <h3 class="panel-title">全部图书</h3>
                </div>
                <div class="panel-body">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>书名</th>
                                <th>作者</th>
                                <th>出版社</th>
                                <th>ISBN</th>
                                <th>价格</th>
                                <th>剩余数量</th>
                                <th>详情</th>
                                <th>编辑</th>
                                <th>删除</th>
                            </tr>
                        </thead>
                        <tbody>
                            <c:forEach items="${books}" var="book">
                                <tr>
                                    <td>
                                        <c:out value="${book.name}"></c:out>
                                    </td>
                                    <td>
                                        <c:out value="${book.author}"></c:out>
                                    </td>
                                    <td>
                                        <c:out value="${book.publish}"></c:out>
                                    </td>
                                    <td>
                                        <c:out value="${book.isbn}"></c:out>
                                    </td>
                                    <td>
                                        <c:out value="${book.price}"></c:out>
                                    </td>
                                    <td>
                                        <c:out value="${book.number}"></c:out>
                                    </td>
                                    <td>
                                        <a href="admin_book_detail.html?bookId=<c:out value=" ${book.bookId}"></c:out>">
                                            <button type="button" class="btn btn-success btn-xs">详情</button>
                                        </a>
                                    </td>
                                    <td>
                                        <a href="updatebook.html?bookId=<c:out value=" ${book.bookId}"></c:out>">
                                            <button type="button" class="btn btn-primary btn-xs">编辑</button>
                                        </a>
                                    </td>
                                    <td>
                                        <a href="deletebook.html?bookId=<c:out value=" ${book.bookId}"></c:out>">
                                            <button type="button" class="btn btn-danger btn-xs">删除</button>
                                        </a>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </body>

        </html>